﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Eis51.CampanyCMS.Business.Bus;
using Eis51.CampanyCMS.Model.Bus;
using Eis51.CampanyCMS.Model;
using Eis51.Web.Admin;

namespace Eis51.CampanyCMS.WebUI.Admin.Order
{
    public partial class ExpressPage : BasePage
    {
        /// <summary>
        /// NewsID 0:新增/否则修改
        /// </summary>
        private string seqno
        {
            get
            {
                if (Request["seqno"] == null)
                {
                    return "0";
                }
                else
                {
                    return (string)Request["seqno"];
                }
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (this.seqno != "0")
                {
                    BaseExpressInc baseexpressinc = BaseExpressIncBLL.GetInstance().Get(new BaseExpressInc.Key(int.Parse(this.seqno)));
                    txtCompany_Name.Text = baseexpressinc.CompanyName;
                    txtDesc.Text = baseexpressinc.Desc;
                }
            }
        }

        
        protected void btnSave_Click(object sender, EventArgs e)
        {
            BaseExpressInc baseexpressinc = null;

            if (this.seqno != "0")
            {
                baseexpressinc = BaseExpressIncBLL.GetInstance().Get(new BaseExpressInc.Key(int.Parse(this.seqno)));
            }
            else
            {
                baseexpressinc = new BaseExpressInc();
                baseexpressinc.CreateBy = AppContext.CurrentAdministrator.Createby;
                baseexpressinc.CreateDate = DateTime.Now;
                baseexpressinc.LastUpdateBy = AppContext.CurrentAdministrator.Createby;
                baseexpressinc.LastUpdateDate = DateTime.Now;
            }
            baseexpressinc.CompanyName = txtCompany_Name.Text;
            baseexpressinc.Desc = txtDesc.Text;
            BaseExpressIncBLL.GetInstance().Subimt(baseexpressinc);
            Response.Redirect("ExpressList.aspx");
        }
    }
}
